
Page({
  data: {
    info: [
      {
        name: '老李',
        content: '吃饭了吗？',
        id: 0,
        pic: 'http://destiny001.gitee.io/image/timg.jpg'
      },
      {
        name: '张三',
        content: '成功转账100',
        id: 1,
        pic: 'http://destiny001.gitee.io/image/monkey_02.jpg'
      },
      {
        name: '王麻子',
        content: '收到红包',
        id: 2,
        pic: 'http://destiny001.gitee.io/image/timg.jpg'
      },
      {
        name: '坤坤',
        content: '我教你rap啊',
        id: 3,
        pic: 'http://destiny001.gitee.io/image/cxk.gif'
      },
      {
        name: '周星星',
        content: '我在打麻将',
        id: 4,
        pic: 'http://destiny001.gitee.io/image/zxc.gif'
      }
    ],
    loading: true
  },
  onPullDownRefresh: function () {
    this.setData({
      loading: !this.data.loading
    })
    setTimeout(()=>{
      wx.stopPullDownRefresh()
      this.setData({
        loading: !this.data.loading
      })
    },1000)
  },
  onShow: function () {
    wx.startPullDownRefresh()
  },
  tapName: function (e) {
    const obj = this.data.info[e.currentTarget.dataset.id]
    var params = ''
    for (var attr in obj) {
      // 将参数转换为字符串格式
      params += attr + '=' + obj[attr] + '&'
    }
    params = params.substr(0, params.length - 1)
    console.log(params)
    wx.navigateTo({
      url: '/pages/about/about' + "?" + params
    })
  }
})
